package com.ruoyi.dgdData.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.dgdData.domain.plat.DataDgdHshl;
import com.ruoyi.dgdData.service.IDataDgdHshlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 单轨吊回绳轮预张紧力测试Controller
 * 
 * @author ruoyi
 * @date 2023-12-28
 */
@RestController
@RequestMapping("/dgd/hshl")
@Api(value="单轨吊测试",tags = "单轨吊回绳轮预张紧力测试接口")
public class DataDgdHshlController extends BaseController
{
    @Autowired
    private IDataDgdHshlService dataDgdHshlService;

    /**
     * 查询单轨吊回绳轮预张紧力测试列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:list')")
    @GetMapping("/list")
    @ApiOperation(value="查询单轨吊回绳轮预张紧力测试列表")
    public TableDataInfo list(DataDgdHshl dataDgdHshl)
    {
        startPage();
        List<DataDgdHshl> list = dataDgdHshlService.selectDataDgdHshlList(dataDgdHshl);
        return getDataTable(list);
    }

    /**
     * 导出单轨吊回绳轮预张紧力测试列表
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:export')")
    @Log(title = "单轨吊回绳轮预张紧力测试", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataDgdHshl dataDgdHshl)
    {
        List<DataDgdHshl> list = dataDgdHshlService.selectDataDgdHshlList(dataDgdHshl);
        ExcelUtil<DataDgdHshl> util = new ExcelUtil<DataDgdHshl>(DataDgdHshl.class);
        util.exportExcel(response, list, "单轨吊回绳轮预张紧力测试数据");
    }

    /**
     * 获取单轨吊回绳轮预张紧力测试详细信息
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:query')")
    @GetMapping(value = "/{hshId}")
    public AjaxResult getInfo(@PathVariable("hshId") Long hshId)
    {
        return success(dataDgdHshlService.selectDataDgdHshlByHshId(hshId));
    }

    /**
     * 新增单轨吊回绳轮预张紧力测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:add')")
    @Log(title = "单轨吊回绳轮预张紧力测试", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataDgdHshl dataDgdHshl)
    {
        return toAjax(dataDgdHshlService.insertDataDgdHshl(dataDgdHshl));
    }

    /**
     * 修改单轨吊回绳轮预张紧力测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:edit')")
    @Log(title = "单轨吊回绳轮预张紧力测试", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataDgdHshl dataDgdHshl)
    {
        return toAjax(dataDgdHshlService.updateDataDgdHshl(dataDgdHshl));
    }

    /**
     * 修改单轨吊回绳轮预张紧力测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:edit')")
    @Log(title = "单轨吊回绳轮预张紧力测试", businessType = BusinessType.UPDATE)
    @PutMapping("/editHshl/{hshId}")
    @ApiOperation(value="修改单轨吊回绳轮预张紧力测试")
    public AjaxResult edit(@PathVariable Long hshId)
    {
        return toAjax(dataDgdHshlService.updateDataDgdHshlByHshId(hshId));
    }

    /**
     * 删除单轨吊回绳轮预张紧力测试
     */
    @PreAuthorize("@ss.hasPermi('dgd:hshl:remove')")
    @Log(title = "单轨吊回绳轮预张紧力测试", businessType = BusinessType.DELETE)
	@DeleteMapping("/{hshIds}")
    public AjaxResult remove(@PathVariable Long[] hshIds)
    {
        return toAjax(dataDgdHshlService.deleteDataDgdHshlByHshIds(hshIds));
    }
}
